'use strict';

import React from 'react';

require('styles/news/NewsItem.css');

class NewsItemComponent extends React.Component {
  constructor(props){
  	super(props)
  	this.handClick=this.handClick.bind(this)
  }

  handClick(){
  	const{item , handleShowNewsDetail}=this.props;
  	handleShowNewsDetail(item.id);
  }	

  render() {
  	const {item,handleShowNewsDetail}=this.props;

    return (
      <a href="#" className="single-post" onClick={this.handClick}>
	      <div className="post-title">{item.title}</div>
	      <div className="post-body">{item.body}</div>
	      <div className="author-details">
	      	{/*<img src="/images/sandeep.png" className="author-photo" />*/} 
	      	<span className="author-name">{item.author}</span>
	      	<span className="pub-date">{item.pubDate}</span>
	      </div>
      </a>
    );
  }
}

NewsItemComponent.displayName = 'NewsNewsItemComponent';

// Uncomment properties you need
// NewsItemComponent.propTypes = {};
// NewsItemComponent.defaultProps = {};

export default NewsItemComponent;
